package com.khyr.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.khyr.Service.DispenseMedicineService;
import com.khyr.Service.ReturnPremiumService;
import com.khyr.entity.HisOrderBackfee;
import com.khyr.vo.GetChargedCareHistoryByRegIdReturnVo;
import com.khyr.vo.QueryParamsVo;
import com.khyr.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：lyk
 * @date ：Created in 2025/3/14 15:15
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/charge/dispenseMedicine")
public class DispenseMedicineController {
    @Autowired
    private DispenseMedicineService dispenseMedicineService;
    @Autowired
    private ReturnPremiumService returnPremiumService;
    @GetMapping("/getChargedCareHistoryOnlyMedicinesByRegId/{regId}")
    public R<GetChargedCareHistoryByRegIdReturnVo> getChargedCareHistoryOnlyMedicinesByRegId(@PathVariable String regId) {
        GetChargedCareHistoryByRegIdReturnVo chargedCareHistoryByRegId = returnPremiumService.getChargedCareHistoryByRegId(regId);
        if (chargedCareHistoryByRegId == null){
            return new R<>(500,"未查询到数据",null );
        }else {
            return new R<>(200,"查询成功",chargedCareHistoryByRegId);
        }
    }
    @PostMapping("/doMedicine")
    public R<String> doMedicine(@RequestBody List<String> items){
        return dispenseMedicineService.doMedicine(items);
    }
}
